<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>getDaysDiffBetweenDates</title>
</head>

<body>
    <script>
        const getDaysDiffBetweenDates = (dateInitial, dateFinal) =>
            (dateFinal - dateInitial) / (1000 * 3600 * 24);
        document.writeln(`2017-12-13与2017-12-22之间相差了${getDaysDiffBetweenDates(new Date('2017-12-13'), new Date('2017-12-22'))}天`)
    </script>
</body>

</html>